package com.wfh.mianshiji.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.wfh.mianshiji.common.BaseResponse;
import com.wfh.mianshiji.common.ResultUtils;
import com.wfh.mianshiji.model.entity.Result;
import com.wfh.mianshiji.service.ResultService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Title: ResultController
 * @Author wangfenghuan
 * @Package com.wfh.mianshiji.controller
 * @Date 2025/11/7 14:27
 * @description:
 */
@RestController
@RequestMapping("/result")
public class ResultController {

    @Resource
    private ResultService resultService;

    /**
     * 获取面试结果
     *
     * @param userId
     * @param interviewId
     * @return
     */
    @GetMapping("/{userId}/{interviewId}")
    public BaseResponse<Result> getResultByUser(@PathVariable("userId") Long userId, @PathVariable("interviewId") Long interviewId) {
        Result one = resultService.getOne(new QueryWrapper<>(Result.class).eq("userId", userId).eq("interviewId", interviewId));
        return ResultUtils.success(one);

    }

}
